@extends('admin_system.layout.layout')

@section('content')
    <br>
    <div class="container-fluid">
        <div class="list-group">
            <a href="#" class="list-group-item active">
                <h4 class="list-group-item-heading">言图 <i class="fa fa-picture-o"></i></h4>
                <p class="list-group-item-text">编辑</p>
            </a>
        </div>

        <div class="panel panel-info">
            <div class="panel-heading">
                <h3 class="panel-title text-center">言图</h3>
            </div>
            <div class="panel-body">
                <form action="{{route('storeSpeak')}}" method="post" enctype="multipart/form-data">
                    {{csrf_field()}}
                    <div class="form-group">
                        <label for="book_name" class="control-label">书名 <i class="fa fa-bookmark-o"></i>:</label>
                        <div class="">
                            <input type="text" name="book_name" id="book_name" class="form-control"
                                   value="{{$data->book_name}}" title=""
                                   required="required">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="content" class="control-label">内容 :</label>
                        <div class="">
                            <input type="text" name="content" id="contentD" class="form-control"
                                   value="{{$data->content}}" title=""
                                   required="required">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="publish_date" class="control-label">发布时间:</label>
                        <div class="">
                            <input type="date" value="{{$data->publish_date}}" name="publish_date" id="publish_date" class="form-control" required="required">
                        </div>
                    </div>


                    <div class="form-group">
                        <label for="bg_img" class="control-label">书籍图片 <i class="fa fa-picture-o"></i>:</label>
                        <div style="width: 200px;border: 1px solid transparent">
                            <img id="pre_img" src="{{asset($data->bg_img)}}" alt="2:3 比例" style="text-align: center;line-height: 200px;width: 100%;display: block;font-size: 35px
;background: grey;">
                        </div>
                        <div class="" style="margin-top: 20px">
                            <input type="file" name="bg_img" id="bg_img" class="form-control">
                        </div>
                    </div>
                    <input type="hidden" name="id" value="{{$data->id}}">

                    <hr>
                    <div class="">
                        <button type="submit" style="width: 100%;margin-top: 20px" class="btn btn-danger">保存</button>
                    </div>
                </form>
            </div>
        </div>
        <script>
            $('#bg_img').on('change', function (e) {
                var file = e.target.files[0];
                var src = URL.createObjectURL(file);
                $('#pre_img').attr('src', src);
            });
        </script>
    </div>
@stop